<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<div class="col-md-12">
	<div class="panel-search">
	
	  <form class="form-inline" action="/region/list">
	  	
	  </form>
	  
	  	<div class="btn-div">
			<div class="div-left">
				<button type="button" class="btn btn-warning" onclick="add('/region/region')">
					<i class="fa fa-plus"></i> <spring:message code="btn.add"></spring:message>
				</button>
				
				<button type="button" class="btn btn-default" name="exportBtn">
		    		<i class="fa  fa-reply"></i> <spring:message code="btn.export"></spring:message>	
		    	</button>
			</div>
		</div>
		
		<button type="button" class="btn btn-default" name="importBtn">
   		  <i class="fa fa-share"></i> <spring:message code="btn.import"></spring:message>	
   		</button>
	  	
	</div>
	
	
	<div class="panel-content"></div>
</div>
<script type="text/javascript">
	$(function(){
		search();
		
		$("button[name='importBtn']").upload({
            action: '${webRoot}/region/importXls',  
            name: 'myFile',
            onComplete: function(data) {
            	if(data.code == 0 ){
            		//上传成功
            		layer.msg(data.message, {shift: 1});
					setTimeout(function(){search();}, 1200);
            	}else {
            		//失败
            		layer.msg(data.message, {shift: 6});
            	}
            }
		});
		
		$("button[name='exportBtn']").click(function(){
			var url = "${webRoot}/region/exportXls"
			window.location.href = url;
		})
	});
</script>